<template>
  <div class="layout-header">
    <div class="left">
      <NuxtLink to="/">NuxtDemo</NuxtLink>
    </div>

    <slot name="header" :user="user">
      <!-- header -->
    </slot>

    <div class="right">
      <Suspense>
        <div class="menu-list" ref="btnWrapper">
          <div class="menu-item"><NuxtLink to="/apilist">接口</NuxtLink></div>
          <div class="menu-item"><NuxtLink to="/about">关于</NuxtLink></div>
          <div class="menu-item"><NuxtLink to="/">首页</NuxtLink></div>
          <!-- 这里是供具体页面放自定义组件的地方 -->
        </div>
      </Suspense>
      <div class="dropdown-menu">下拉菜单</div>
    </div>
  </div>
</template>

<script setup lang="ts">
const user = ref("user默认值");
</script>

<style lang="scss" scoped>
.layout-header {
  width: 100%;
  height: 56px;
  border-bottom: 1px solid #eee;
  box-shadow: 0 1px 6px 2px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;

  .right {
    height: 100%;
    display: flex;
    align-items: center;

    .menu-list {
      height: 100%;
      min-width: 5vw;
      max-width: 45vw;
      background-color: rgba(255, 0, 0, 0.1);
      display: flex;
      flex-direction: row-reverse;
      align-items: center;
      justify-content: space-around;
      padding: 0 8px;

      .menu-item {
        & + .menu-item {
          margin-right: 8px;
        }
      }
    }
  }
}
</style>
